package o;

import android.util.Pair;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.source.ads.AdPlaybackState;
import com.google.android.exoplayer2.source.ads.AdPlaybackState.b;

public abstract class abr {
    public static final abr ˊ = new abr() {
        public int ॱ() {
            return 0;
        }

        public e ˊ(int i, e eVar, boolean z, long j) {
            throw new IndexOutOfBoundsException();
        }

        public int ˎ() {
            return 0;
        }

        public c ॱ(int i, c cVar, boolean z) {
            throw new IndexOutOfBoundsException();
        }

        public int ˎ(Object obj) {
            return -1;
        }

        public Object ˋ(int i) {
            throw new IndexOutOfBoundsException();
        }
    };

    public static final class c {
        private AdPlaybackState ʽ;
        public Object ˊ;
        public Object ˋ;
        public long ˎ;
        private long ˏ;
        public int ॱ;

        public c ˏ(Object obj, Object obj2, int i, long j, long j2) {
            return ˎ(obj, obj2, i, j, j2, AdPlaybackState.ˏ);
        }

        public c ˎ(Object obj, Object obj2, int i, long j, long j2, AdPlaybackState adPlaybackState) {
            this.ˊ = obj;
            this.ˋ = obj2;
            this.ॱ = i;
            this.ˎ = j;
            this.ˏ = j2;
            this.ʽ = adPlaybackState;
            return this;
        }

        public long ˏ() {
            return this.ˎ;
        }

        public long ˋ() {
            return C.ˋ(this.ˏ);
        }

        public long ˊ() {
            return this.ˏ;
        }

        public int ˎ() {
            return this.ʽ.ˎ;
        }

        public long ˋ(int i) {
            return this.ʽ.ॱ[i];
        }

        public int ˎ(int i) {
            return this.ʽ.ˋ[i].ॱ();
        }

        public int ˎ(int i, int i2) {
            return this.ʽ.ˋ[i].ˊ(i2);
        }

        public boolean ˏ(int i) {
            return !this.ʽ.ˋ[i].ˎ();
        }

        public int ˋ(long j) {
            return this.ʽ.ˊ(j);
        }

        public int ˏ(long j) {
            return this.ʽ.ˏ(j);
        }

        public int ˊ(int i) {
            return this.ʽ.ˋ[i].ˊ;
        }

        public boolean ॱ(int i, int i2) {
            b bVar = this.ʽ.ˋ[i];
            return (bVar.ˊ == -1 || bVar.ˎ[i2] == 0) ? false : true;
        }

        public long ˊ(int i, int i2) {
            b bVar = this.ʽ.ˋ[i];
            return bVar.ˊ != -1 ? bVar.ˋ[i2] : -9223372036854775807L;
        }

        public long ॱ() {
            return this.ʽ.ˊ;
        }
    }

    public static final class e {
        public long ʻ;
        public long ʼ;
        public int ʽ;
        @Nullable
        public Object ˊ;
        public boolean ˋ;
        public long ˎ;
        public long ˏ;
        public boolean ॱ;
        public long ॱॱ;
        public int ᐝ;

        public e ˏ(@Nullable Object obj, long j, long j2, boolean z, boolean z2, long j3, long j4, int i, int i2, long j5) {
            this.ˊ = obj;
            this.ˎ = j;
            this.ˏ = j2;
            this.ॱ = z;
            this.ˋ = z2;
            this.ʼ = j3;
            this.ʻ = j4;
            this.ʽ = i;
            this.ᐝ = i2;
            this.ॱॱ = j5;
            return this;
        }

        public long ˋ() {
            return C.ˋ(this.ʼ);
        }

        public long ˊ() {
            return this.ʼ;
        }

        public long ˏ() {
            return C.ˋ(this.ʻ);
        }

        public long ˎ() {
            return this.ॱॱ;
        }
    }

    public abstract e ˊ(int i, e eVar, boolean z, long j);

    public abstract Object ˋ(int i);

    public abstract int ˎ();

    public abstract int ˎ(Object obj);

    public abstract int ॱ();

    public abstract c ॱ(int i, c cVar, boolean z);

    public final boolean ˏ() {
        return ॱ() == 0;
    }

    public int ˏ(int i, int i2, boolean z) {
        switch (i2) {
            case 0:
                return i == ˎ(z) ? -1 : i + 1;
            case 1:
                return i;
            case 2:
                if (i == ˎ(z)) {
                    return ˏ(z);
                }
                return i + 1;
            default:
                throw new IllegalStateException();
        }
    }

    public int ˎ(boolean z) {
        return ˏ() ? -1 : ॱ() - 1;
    }

    public int ˏ(boolean z) {
        return ˏ() ? -1 : 0;
    }

    public final e ˎ(int i, e eVar) {
        return ˊ(i, eVar, false);
    }

    public final e ˊ(int i, e eVar, boolean z) {
        return ˊ(i, eVar, z, 0);
    }

    public final int ˎ(int i, c cVar, e eVar, int i2, boolean z) {
        int i3 = ˏ(i, cVar).ॱ;
        if (ˎ(i3, eVar).ᐝ != i) {
            return i + 1;
        }
        i3 = ˏ(i3, i2, z);
        if (i3 == -1) {
            return -1;
        }
        return ˎ(i3, eVar).ʽ;
    }

    public final boolean ˊ(int i, c cVar, e eVar, int i2, boolean z) {
        return ˎ(i, cVar, eVar, i2, z) == -1;
    }

    public final Pair<Object, Long> ˏ(e eVar, c cVar, int i, long j) {
        return ˋ(eVar, cVar, i, j, 0);
    }

    public final Pair<Object, Long> ˋ(e eVar, c cVar, int i, long j, long j2) {
        amm.ˏ(i, 0, ॱ());
        ˊ(i, eVar, false, j2);
        if (j == -9223372036854775807L) {
            j = eVar.ˊ();
            if (j == -9223372036854775807L) {
                return null;
            }
        }
        int i2 = eVar.ʽ;
        long ˎ = eVar.ˎ() + j;
        long ˏ = ॱ(i2, cVar, true).ˏ();
        while (ˏ != -9223372036854775807L && ˎ >= ˏ && i2 < eVar.ᐝ) {
            ˎ -= ˏ;
            i2++;
            ˏ = ॱ(i2, cVar, true).ˏ();
        }
        return Pair.create(cVar.ˋ, Long.valueOf(ˎ));
    }

    public c ॱ(Object obj, c cVar) {
        return ॱ(ˎ(obj), cVar, true);
    }

    public final c ˏ(int i, c cVar) {
        return ॱ(i, cVar, false);
    }
}
